/*
 * @Author: LiaoShuang 345324985@qq.com
 * @Date: 2023-03-24 23:55:57
 * @LastEditors: liaoshuang 345324985@qq.com
 * @LastEditTime: 2024-01-15 11:32:33
 * @FilePath: \threejs\vite.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue2";

import { resolve } from "path";
import legacy from "@vitejs/plugin-legacy";
export default defineConfig({
  plugins: [
    vue(),
    legacy({
      targets: ["IE 11"],
      additionalLegacyPolyfills: ["regenerator-runtime/runtime"], // 面向IE11时需要此插件
      // renderLegacyChunks: true,
      // polyfills: [
      //   'es.symbol',
      //   'es.promise',
      //   'es.promise.finally',
      //   'es/map',
      //   'es/set',
      //   'es.array.filter',
      //   'es.array.for-each',
      //   'es.array.flat-map',
      //   'es.object.define-properties',
      //   'es.object.define-property',
      //   'es.object.get-own-property-descriptor',
      //   'es.object.get-own-property-descriptors',
      //   'es.object.keys',
      //   'es.object.to-string',
      //   'web.dom-collections.for-each',
      //   'esnext.global-this',
      //   'esnext.string.match-all'
      // ]
    }),
  ],
  build: {
    target: "IE 11",
  },
  server: {
    // https: true,
    // Listening on all local IPs
    host: true,
    port: 5002,
    // Load proxy configuration from .env
    proxy: {
      "/SicCore": {
        target: "http://192.168.1.4:10011/SicCore",
        // target: "http://192.168.10.16:11150/SicCore",
        changeOrigin: true,
        ws: true,
        secure: false,
        rewrite: (path) => path.replace(/^\/SicCore/, ""),
      },
    },
  },
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
    },
  },
});
